<template>

	<div style="width: 100%;height: 2000px;">

		<div>
			<h3>查询我的成绩</h3>

			<table border="1px" style="width: 100%;height: 30%;">

				<tr>
					<th>我的账号</th>
					<th>学科</th>
					<th>分数</th>
					<th>登分时间</th>
				</tr>

				<tr v-for="(x,idx) in data.myMark">
					<td>{{x.user.phone}}</td>
					<td>{{x.course.cno}}</td>
					<td>{{x.score}}</td>
					<td>{{x.tpostx}}</td>
				</tr>

			</table>

		</div>

	</div>

</template>

<script setup>
	import {
		ref,
		reactive,
		onMounted
	} from 'vue';
	import {
		$get
	} from '../../ajax';
	import {
		format
	} from 'date-fns';

	const data = reactive({
		myMarks: [],
	})

	onMounted(() => {


		$get("/api/fore/stu/findMyMark")
			.then((resp) => {

				data.myMarks = resp.data.data;
				for (var i = 0; i < data.myMarks.length; i++) {
					let myMark = data.myMarks[i]
					myMark.tpostx = format(myMark.tpost, 'yyyy年MM月dd日')
				}
				console.log("==========")
				console.log(data.myMark)

			})


	})
</script>

<style>
</style>
